Object.prototype.say = 'hello'

const obj = {
  name: '张三',
  age: 18,
  like: {
    n: 'running'
  }
}

function deepClone(obj) {
  let res = obj instanceof Array ? [] : {}
  for (let key in obj) {
    if (obj.hasOwnProperty(key)) {
      if (typeof obj[key] === 'object' && typeof obj[key] !== null) {
        res[key] = deepClone(obj[key])
      } else {
        res[key] = obj[key]
      }
    }
  }

  return res
}

let newObj = deepClone(obj)
newObj.like.n = 'say'
console.log(newObj);    // { name: '张三', age: 18, like: { n: 'say' } }
